package com.hu.zhcc.shiro.controller;


import com.hu.zhcc.shiro.entity.tj.TClinicDepartment;
import com.hu.zhcc.shiro.entity.tj.TDiseaseLibrary;
import com.hu.zhcc.shiro.service.Tj_TClinicDepartmentService;
import com.hu.zhcc.shiro.service.Tj_TDiseaseLibraryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 疾病库 前端控制器
 * </p>
 *
 * @author tj
 * @since 2021-06-24
 */
@RestController
@RequestMapping("/tjtDiseaseLibrary")
public class TjTDiseaseLibraryController {
    @Autowired
    private Tj_TClinicDepartmentService tjTClinicDepartmentService;//就诊科室表
    @Autowired
    private Tj_TDiseaseLibraryService tj_tDiseaseLibraryService;//疾病表
    //查询 所有
    @GetMapping("/queryAll")
    public List<TDiseaseLibrary> queryAll(){
        return tj_tDiseaseLibraryService.queryAll();
    }
    //根据编号查询
    @GetMapping("/{id}")
    public TDiseaseLibrary queryById(@PathVariable("id")Integer id) {
        return tj_tDiseaseLibraryService.queryById(id);
    }
    //添加疾病
    @PostMapping("")
    public int addTdisease(@RequestBody TDiseaseLibrary tDiseaseLibrary){
        return tj_tDiseaseLibraryService.addTdisease(tDiseaseLibrary);
    }
    //修改疾病
    @PutMapping("")
    public int updTdisease(@RequestBody TDiseaseLibrary tDiseaseLibrary){
        return tj_tDiseaseLibraryService.updTdisease(tDiseaseLibrary);
    }
    //查询就诊科室
    @GetMapping("/all")
    public List<TClinicDepartment> queryAlljzks(){
        return tjTClinicDepartmentService.queryAll();
    }
}

